The invention relates to computer-implemented methods for rendering electronic documents.
Many graphics or imaging processing computer programs, such as Adobe® Photoshop®, available from Adobe Systems Incorporated, of San Jose, Calif., build a final image by compositing two or more graphical objects together. The graphical objects on an electronic document can be thought of as forming a stack, where the stacking order is defined to be the order in which the graphical objects are specified, typically bottommost object first. The graphical objects can be represented by an array of pixels or analytically, e.g., by using shape outlines, or by other functions which map positions to data values. Each pixel has a color value (which can include multiple colorant values) representing a color. For example, a color in RGB color space includes three colorant values: one for each red, green, and blue. Likewise a color value in CMYK color space may include four colorant values: one for each cyan, magenta, yellow, and key (black). Each pixel can optionally also have an alpha value which represents the transparency of the pixel, with an alpha value of 0 representing a pixel that is completely transparent and an alpha value of 1 representing a pixel that is opaque.
In an opaque imaging model (i.e., with no transparency), the color of the page at any point is defined to be the color of the topmost object at that point, disregarding any overlapping objects that fall below that object in the stack. This effect can be realized by defining a painting order (that describes the sequence of placing the graphical objects in an image) in which the objects are simply rasterized directly onto the page in the order that they are specified. Objects that are earlier in the painting order appear in the background behind objects later in the order. By contrast, in a transparency imaging model, object transparency is taken into account, such that all of the objects in the stack can potentially contribute to the result. At any given point, the color of a given image location or pixel is determined by combining the colors of all objects that include the location or pixel as a function of the transparency of those objects.
In addition to these rendering rules, anti-aliasing algorithms can be used when rendering a foreground graphical object. Anti-aliasing can smooth out displayed or printed text. In the printing process when rasterizing an object (including text and non-text objects) having a foreground color to a background within a frame buffer for display or printing, it can be important to know the background color as it may determine the anti-aliasing algorithm to use. For example, if the background is white, then an anti-aliasing algorithm can be used that is optimized for drawing foreground objects on a white background. Additionally, if the background color is known, then it is possible for the anti-aliasing algorithm to pre-blend the edge pixels of the foreground object with a color similar to (or the same as) that of the background color. Once the edge pixels of the foreground object are pre-blended, an opaque-imaging model can be used and the foreground object can be directly rendered onto the background.